﻿namespace Vdc.Grid
{
    using Vdc.Grid.Design;
    using System;
    using System.ComponentModel;

    [TypeConverter(typeof(GridGroupingSettingsConverter))]
    public class GridGroupingSettings : GridPersistentObject, ICloneable
    {
        public object Clone()
        {
            return new GridGroupingSettings { AllowChanges = this.AllowChanges };
        }

        public virtual bool Equals(GridGroupingSettings settings)
        {
            if (this.AllowChanges != settings.AllowChanges)
            {
                return false;
            }
            return true;
        }

        object ICloneable.Clone()
        {
            return this.Clone();
        }

        [Bindable(true), DefaultValue(true), NotifyParentProperty(true), Description("Gets or sets a value indicating whether end users will be allowed to change the initial grouping."), Category("Grouping")]
        public bool AllowChanges
        {
            get
            {
                object obj2 = base.ViewState["AllowChanges"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                base.ViewState["AllowChanges"] = value;
            }
        }
    }
}

